<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>测试json值的改变</title>
</head>
<body>
<script type="text/javascript">
    window.onload=function(){
        //直接更换json的key
        let data = [
            {count:335, goods:'直接访问'},
            {count:310, goods:'邮件营销'},
            {count:234, goods:'联盟广告'}
        ]

        data=data.map(function(item) {
            return {
                name: item.goods,
                value: item.count
            }
        });
        alert(JSON.stringify(data));
/////////////////////////////////////////////////////////////////////////////////////////


        let fuck1={name1:'韩韩',age1:'30'};
        //下面四句都是更换属性名字
        fuck1.name=fuck1.name1;
        delete fuck1.name1;
        fuck1.age=fuck1.age1;
        delete fuck1.age1;
        
        alert(JSON.stringify(fuck1));
    };


</script>
</body>
</html>